CustomOperator.AddPortGroup

導入

v4.0

詳細

カスタムオペレータに新しいPortGroupを作成し、戻します。

通常のカスタムオペレータには 1 つの PortGroup だけが必要ですが、ダイナミックオペレータでは、動的に接続される必要がある入力ポートや複数のインスタンスを伴う入力ポートに対して別の PortGroup を作成する必要があります。

注:オペレータでブランチグループがサポートされている場合は、フィルタが、許可されているコンポーネントとしてのグループと一致する必要もあります。一致しない場合は、Operator.Connectの呼び出し時にグループは拒否されます。

スクリプト 構文

oReturn = CustomOperator.AddPortGroup( Name, [Min], [Max], [Filter], [PickPrompt], [Flags] );

戻り値

新しく作成されたPortGroupオブジェクトを戻します。

パラメータ

パラメータ タイプ 詳細
Name String ポートの名前。
最小 Long 有効な接続に必要な最小のオブジェクト

デフォルト値: 1

最大 Long 有効な接続に必要な最小のオブジェクト

デフォルト値: 1

フィルタ String オブジェクトをグループに接続できるかどうかを決定するために使用するフィルタ

デフォルト値:""(フィルタは定義されません)

PickPrompt String オペレータに接続するオブジェクトを選択する選択セッション中にステータスバーに表示される文字列

デフォルト値:""(選択対象は定義されません)

フラグ Long ポートグループフラグのマスク(実装されていません)

デフォルト値:0(フラグは定義されません)

JScript の例

/*
        This example illustrates how to use the AddPortGroup method to define 
        a PortGroup. Use this method if you want to determine the number
        of objects that can be connected to the group or restrict the 
        types of objects connecting to the group by using a filter.
*/
NewScene( null, false );
var obj = CreatePrim( "Cube", "MeshSurface");
var sop = XSIFactory.CreateScriptedOp( "MyOperator", MyOperator_Update.toString(), "JScript" )
var group = sop.AddPortGroup( "MainGroup", 1, 1, siPolyMeshFilter, "please pick a polygon mesh" );
sop.AddIOPort( obj.ActivePrimitive, "", group.Index );
sop.Connect();
// The operator's update function
function MyOperator_Update( ctx, out, in1 ) 
{
        Application.LogMessage( "MyOperator_Update: " + out.Value );
        var aPos = in1.Value.Geometry.Points.PositionArray.toArray();
        out.Value.Geometry.Points.PositionArray = aPos;
}